package com.fuluwa.depart.pc.interfaces.web;

import java.util.HashMap;
import java.util.Map;

/**
 * 通用的结果返回对象
 * 
 * @author leasenli
 *
 */
public final class Result {
	protected int retCode; // 返回码，用于数据统计
	protected int errCode; // 业务错误码
	protected String errMsg; // 业务错误信息
	protected String t; // 请求时间戳
	protected String token; // 传给后台的 token 码,防止 xsrf 攻击,从 g_tk 参数获取,预留字段
	protected Map<String, Object> data = new HashMap<String, Object>(); // 业务数据

	public Result() {
	}

	public Result(int errCode, String errMsg) {
		this.errCode = errCode;
		this.errMsg = errMsg;
	}

	public Result(int errCode, String errMsg, String t) {
		this.errCode = errCode;
		this.errMsg = errMsg;
		this.t = t;
	}

	public Result(int errCode, String errMsg, String t, String token) {
		this.errCode = errCode;
		this.errMsg = errMsg;
		this.t = t;
		this.token = token;
	}

	public Result(int errCode, String errMsg, String t, String token,
			Map<String, Object> data) {
		this.errCode = errCode;
		this.errMsg = errMsg;
		this.t = t;
		this.token = token;
		this.data = data;
	}

	/**
	 * 增加业务数据
	 * 
	 * @param key
	 * @param value
	 */
	public void addData(String key, Object value) {
		data.put(key, value);
	}

	public int getRetCode() {
		return retCode;
	}

	public void setRetCode(int retCode) {
		this.retCode = retCode;
	}

	public int getErrCode() {
		return errCode;
	}

	public void setErrCode(int errCode) {
		this.errCode = errCode;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	public String getT() {
		return t;
	}

	public void setT(String t) {
		this.t = t;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public Map<String, Object> getData() {
		return data;
	}

	public void setData(Map<String, Object> data) {
		this.data = data;
	}

}